import {http} from "@/api/index";

const user = {
    getAllUserList:'/user/findAll',
    getUserInfo:'/user/info',
    addUser:'/user/add',
    updateUser:'/user/update',
    deleteUser:'/user/delete',
    checkedRoles:'/user/checkedRoles',
    addOrDeleteUserRole:'/user/addOrDeleteUserRole',
    adminUpdatePassword:'/user/adminUpdatePassword',
    queryUserLike:'/user/queryUserLike'
}


export const getAllUserList = ()=>{
    return http.request({
        url:user.getAllUserList,
        method:'get'
    })
}
export const queryUserLike = (param)=>{
    return http.request({
        url:user.queryUserLike,
        method:'get',
        params:{
            userLike:param
        }
    })
}
export function addUser(params){
    return http.request({
        url:user.addUser,
        method:'post',
        data:params
    })
}
export function updateUser(params){
    return http.request({
        url:user.updateUser,
        method:'post',
        data:params
    })
}

export function deleteUser(userId){
    return http.request({
        url:user.deleteUser,
        method:'get',
        params:{
            userId
        }
    })
}
export function checkedRoles(userId){
    return http.request({
        url:user.checkedRoles,
        method:'get',
        params:{
            userId:userId
        }
    })
}
export function addOrDeleteUserRole(params){
    return http.request({
        url:user.addOrDeleteUserRole,
        method:'post',
        data:params
    })
}
export function adminUpdatePassword(params){
    return http.request({
        url:user.adminUpdatePassword,
        method:'post',
        data:params
    })
}
